package br.com.async.core.application.impl;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import br.com.async.core.application.PersonApplication;
import br.com.async.core.domain.address.City;
import br.com.async.core.domain.address.State;
import br.com.async.core.domain.person.Person;
import br.com.async.core.domain.person.PersonRepository;
@Transactional (propagation = Propagation.REQUIRED)
public class PersonApplicationImpl implements PersonApplication {

	private PersonRepository personRepository;
	
	
	public PersonApplicationImpl(PersonRepository personRepository) {
		super();
		this.personRepository = personRepository;
	}

	@Override
	public List<City> findCityByState(Integer code) {
		return personRepository.findCityByState(code);
	}

	@Override
	public List<Person> findByName(String name) {
		return personRepository.findByName(name);
	}

	@Override
	public List<State> listAllStates() {
		return personRepository.listAllStates();
	}

	@Override
	public List<City> listAllCities() {
		return personRepository.listAllCities();
	}

	@Override
	public City findCityById(int code) {
		return personRepository.findCityById(code);
	}

}
